﻿using LearnMAUI2.Models;
using System.Globalization;

namespace LearnMAUI2.Converters;

public class PoetryToStringConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
        value is Poetry poetry ? $"{poetry.Dynasty} - {poetry.Author}  {poetry.Snippet}" : null;

    //很少会用到反向转换，一般都只是正向转换
    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
